﻿using System;
using System.Collections.Generic;
using System.Text;

namespace KeyCtrl
{
    class HotKeyFilter
    {
        public KeyCombo Combo;
        private KeyDaemon _daemon;
        public event EventHandler Event;

        public HotKeyFilter(KeyCombo combo, KeyDaemon daemon, EventHandler invokeEvent)
        {
            Combo = combo;
            _daemon = daemon;
            Event = invokeEvent;

            _daemon.SetEventHandler(new EventHandler(HotKeyPressed));
        }

        private void HotKeyPressed(object sender, System.EventArgs e)
        {
            if (_daemon.PressedKeys.Equals(Combo))
            {
                if (Event != null)
                    Event(this, new EventArgs());
            }    
        }
    }
}
